package com.ghpt.controller;
import com.ghpt.pojo.JuGuang;
import com.ghpt.service.JuGuangService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/juguang")
public class JuGuangController {
    private final JuGuangService juGuangService;

    public JuGuangController(JuGuangService juGuangService) {
        this.juGuangService = juGuangService;
    }
    @GetMapping("/{id}")
    public JuGuang getJuGuangById(@PathVariable Long id) {
        System.out.println("结果是"+juGuangService.findJuGuangById(id));
        return juGuangService.findJuGuangById(id);
    }
    @PutMapping
    public int updateJuGuang(@RequestBody JuGuang juGuang) {
        return juGuangService.updateById(juGuang);
    }
}
